<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>添加随访提醒</title>
    <meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no"/>
    <link rel="stylesheet" href="https://res.wx.qq.com/open/libs/weui/1.1.3/weui.min.css">
    <script src="http://cdn.static.runoob.com/libs/jquery/2.1.1/jquery.min.js"></script>
    <style>
        * {
            padding: 0;
            margin: 0;
        }
        body {
            background-color: #f8f8f8;
        }
    </style>
</head>
<body>
<div class="page">
    <div class="weui-cells__title">随访提醒</div>
    <div class="weui-cells weui-cells_form">
        <div class="weui-cell">
            <div class="weui-cell__hd"><label class="weui-label">标题</label></div>
            <div class="weui-cell__bd">
                <input id="title" class="weui-input" type="text" placeholder="请输入标题" value=""/>
            </div>
        </div>
        <div class="weui-cell">
            <div class="weui-cell__hd"><label class="weui-label">时间</label></div>
            <div class="weui-cell__bd">
                <input id="datetime" class="weui-input" type="date" value=""/>
            </div>
        </div>
        <div class="weui-cell weui-cell_select weui-cell_select-after">
            <div class="weui-cell__hd">
                <label for="" class="weui-label">提醒</label>
            </div>
            <div class="weui-cell__bd">
                <select id="remind" class="weui-select">
                    <option value="无">无</option>
                    <option value="提前5分钟">提前5分钟</option>
                    <option value="提前15分钟">提前15分钟</option>
                    <option value="提前1小时">提前1小时</option>
                </select>
            </div>
        </div>
    </div>
    <div class="weui-cells__title">备注</div>
    <div class="weui-cells weui-cells_form">
        <div class="weui-cell">
            <div class="weui-cell__bd">
                <textarea id="comments" class="weui-textarea" placeholder="请输入备注" rows="3"></textarea>
            </div>
        </div>
    </div>
    <div class="weui-btn-area">
        <a class="weui-btn weui-btn_primary" href="javascript:" onclick="save(this)">确定</a>
        <a class="weui-btn weui-btn_default" href="javascript:" onclick="history.back();">返回</a>
    </div>
</div>

<div id="dialog-success" style="display: none;">
    <div class="weui-mask"></div>
    <div class="weui-dialog">
        <div class="weui-dialog__hd"><strong class="weui-dialog__title">保存成功</strong></div>
        <div class="weui-dialog__ft">
            <a href="javascript:$('#dialog-success').hide(); history.back();" class="weui-dialog__btn weui-dialog__btn_primary">确定</a>
        </div>
    </div>
</div>
    
</body>
<script>
    var now = new Date();
    var day = ("0" + now.getDate()).slice(-2);
    var month = ("0" + (now.getMonth() + 1)).slice(-2);
    var today = now.getFullYear()+"-"+(month)+"-"+(day);

    $("#datetime").val(today);
    function save() {
        var data={};
        data.title = $('#title').val();
        data.datetime = $('#datetime').val();
        data.remind = $('#remind').val();
        data.comments = $('#comments').val();
        $.ajax({
            type: "POST",
            url: "http://patient-demo.huimeimt.cn:8080/followRemind/insertFollowRemind",
            data: JSON.stringify(data),
            dataType: 'json',
            contentType: 'application/json',
            success: function (data) {
                console.log(data)
                $("#dialog-success").show();
            },
        });
    }
</script>
</html>
